package cn.edu.jxyy.mybatistest.test;

import cn.edu.jxyy.mybatistest.Utils.MyBatisUtils;
import cn.edu.jxyy.mybatistest.mapper.StudentMapper;
import cn.edu.jxyy.mybatistest.pojo.Student;
import org.apache.ibatis.session.SqlSession;

public class part11_Insert2 {
    public static void main(String[] args) {
        SqlSession sqlSession = MyBatisUtils.getSession();
        StudentMapper mapper = sqlSession.getMapper(StudentMapper.class);
        Student student = new Student();
        student.setName("pdd");
        student.setAge(20);
        int i = mapper.addStudent(student);
        System.out.println(i);
        System.out.println(student.getId());
        sqlSession.commit();
        sqlSession.close();
    }
}